<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <div id="app">
    <!-- <h2>Hello World</h2> -->
  </div>
  <script>
    // let h2=document.querySelector('h2')
    // let h2=document.getElementsByTagName('h2')[0]
    // h2.innerHTML=`hello vue`
    // console.log(h2);
    // 使用vue操作

    const App = {
      template: `
        <div>
        <h2>{{message}}</h2>
        <h3>{{count}}</h3>
        <button @click="add">+1</button>
        <button @click="decrease">-1</button>
        </div>`,
      data: function () {
        return {
          message: '你好安',
          count: 0
        }
      },
      methods: {
        add() {
          // console.log(123);
          this.count += 1
        },

        decrease() {
          this.count -= 1
        }
      }

    }
    Vue.createApp(App).mount('#app')

  </script>
</body>

</html>